from selenium.webdriver.common.by import By

from BasePage.basepage import BasePage


class CardOrder(BasePage):
    def __init__(self, driver):
        super().__init__(driver)
        self.driver = driver
        #     选择商品
        self.card_loc = (By.ID, "com.tpshop.malls:id/product_pic_img")
        #     加入购物车
        self.card_order_loc = (By.ID, "com.tpshop.malls:id/add_cart_tv")
        # 确认
        self.sure = (By.ID, "com.tpshop.malls:id/confirm_tv")

    def card_order(self):
        self.click_element(self.card_loc)
        self.click_element(self.card_order_loc)
        self.click_element(self.sure)
